const { cleanDatEnglishText } = require("../src/utils/datTextCleaner");

// 测试$you words$$$$$格式
const testCases = [
  {
    input: "$you words$$$$$",
    description: "以$开头的格式",
  },
  {
    input: "test$test$$$$$",
    description: "正常word$word格式",
  },
  {
    input: "due to$due to$$$$$",
    description: "词组重复格式",
  },
  {
    input: "as soon as possible$as soon as possible$$$$$",
    description: "长词组重复格式",
  },
  {
    input: "$$$$$",
    description: "只有美元符号",
  },
  {
    input: "word$$$$$",
    description: "单词后跟多个美元符号但没有$分隔符",
  },
];

console.log("测试$格式处理:\n");

testCases.forEach((testCase, index) => {
  try {
    const result = cleanDatEnglishText(testCase.input);
    console.log(`测试 ${index + 1} (${testCase.description}):`);
    console.log(`  输入: "${testCase.input}"`);
    console.log(`  输出: "${result}"`);
    console.log("");
  } catch (error) {
    console.log(`测试 ${index + 1} (${testCase.description}) 出错:`, error.message);
    console.log("");
  }
});

// 特别测试实际DAT文件中可能出现的情况
console.log("实际DAT条目测试:\n");

const realWorldExamples = ["^Please$please$$$$$^ ^give$give$$$$$^ ^our$our$$$$$^", "^due to$due to$$$$$^ ^omission$omission$$$$$^", "^as soon as possible$as soon as possible$$$$$^"];

realWorldExamples.forEach((example, index) => {
  const result = cleanDatEnglishText(example);
  console.log(`示例 ${index + 1}:`);
  console.log(`  输入: ${example}`);
  console.log(`  输出: ${result}`);
  console.log("");
});
